﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace 实验三
{
    public partial class _3_2_a : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                DataClasses1DataContext data=new DataClasses1DataContext();
                var x = from s in data.Student
                        select s;
                DropDownList1.DataSource = x;
                DropDownList1.DataBind();
                
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "您选择的学生学号是：" + DropDownList1.SelectedValue + " "+"姓名是：" + DropDownList1.SelectedItem;
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}